<!-- 商户商品列表 -->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"  xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<link href="/css/jquery-select/jquery.searchableSelect.css" rel="stylesheet" type="text/css">
<meta charset="utf-8">
<meta charset="utf-8">
<head th:include="include :: header">
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content ">
    <div class="col-sm-12">
        <div class="ibox">
            <div class="ibox-body">
                <div class="fixed-table-toolbar">

                    <div class="columns pull-left">
                        <!--                        <button type="button" class="btn btn-primary" onclick="toSelectProduct()">-->
                        <!--                            &lt;!&ndash; data-toggle="modal" data-target="#myModal" &ndash;&gt;-->
                        <!--                            <i class="fa fa-check"></i>挑选平台商品-->
                        <!--                        </button>-->
                    </div>

                    <div class="columns pull-left col-md-1 nopadding">
                        <select data-placeholder="类型" id="type" class="form-control chosen-select" tabindex="2">
                            <option value="" selected>状态</option>
                            <option value="1">上架</option>
                            <option value="0">下架</option>
                        </select>
                    </div>

                    <!-- <div class="columns pull-left col-md-1 nopadding">
                        <select data-placeholder="属性" id="type"
                            class="form-control chosen-select" tabindex="2">
                            <option selected>属性</option>
                            <option value="1">上架</option>
                            <option value="0">下架</option>
                        </select>
                    </div> -->
                    <!--                    <div class="columns pull-left col-md-1 nopadding">-->
                    <!--                        <select id="pcate" id="pcate"-->
                    <!--                                class="form-control chosen-select" tabindex="2"-->
                    <!--                                onchange="renderCategoryThird2(this)">-->

                    <!--                            <option value="" selected>顶级分类</option>-->
                    <!--                            <option th:each="item: ${category}" th:text="${item.name}+'('+${item.typeName}"-->
                    <!--                                    th:value="${item.id}" onchange="renderCategoryThird(this)"></option>-->
                    <!--                        </select>-->
                    <!--                    </div>-->
                    <div class="columns pull-left col-md-1 nopadding">
                        <div class="class-close-content">
                            <input type="text" id="pcate" class="form-control chosen-select" placeholder="顶级分类"
                                   onclick="toCategoryOne()" readonly/>
                            <a id="pcate-close" class="glyphicon glyphicon-remove close-icon" onclick="categoryCloseClick('one')"></a>
                        </div>
                        <input type="hidden" id="pcateId"/>
                    </div>
                    <div class="columns pull-left col-md-1 nopadding">
                        <div class="class-close-content">
                            <input type="text" id="ccate" class="form-control chosen-select" placeholder="下级分类"
                                   onclick="toCategoryTwo()" readonly/>
                            <a id="ccate-close" class="glyphicon glyphicon-remove close-icon" onclick="categoryCloseClick('two')"></a>
                        </div>
                        <input type="hidden" id="ccateId"/>
                    </div>
                    <!--                    <div class="columns pull-left col-md-1 nopadding">-->
                    <!--                        <select id="ccate" id="ccate"-->
                    <!--                                class="form-control chosen-select" tabindex="2">-->
                    <!--                            <option value="" selected>下级分类</option>-->
                    <!--                        </select>-->
                    <!--                    </div>-->
                    <div class="columns pull-left col-md-1 nopadding">
                        <select  id="supply"
                                class="form-control chosen-select" tabindex="2">
                            <option value="" selected>供应商</option>
                            <option th:each="item: ${supply}" th:text="${item.name}"
                                    th:value="${item.id}"></option>
                        </select>
                    </div>
                    <div class="columns pull-left col-md-2 nopadding" th:if="${teamId == null}">
                        <select  id="liansuoid"
                                class="form-control chosen-select" tabindex="2">
                            <option value="0" selected>选择门店</option>
                            <option th:each="item: ${teams}" th:text="${item.tXiaoqu+ +item.id}"
                                    th:value="${item.id}"></option>
                        </select>
                    </div>
                    <!--<div class="columns pull-left col-md-2 nopadding">-->
                    <!--<select id="isSource" -->
                    <!--class="form-control chosen-select" tabindex="2">-->
                    <!--<option value="">选择商品来源</option>-->
                    <!--<option value="0">门店</option>-->
                    <!--<option value="1">非门店</option>-->
                    <!--</select>-->
                    <!--</div>-->
                    <!-- <div class="columns pull-left col-md-1 nopadding">
                        <button class="btn btn-success" onclick="reLoad()">
                            <i class="fa fa-search" aria-hidden="true"></i>导出excel
                        </button>
                    </div> -->
                    <!--<div class="columns pull-left col-md-1 nopadding">-->
                    <!--<select data-placeholder="商品区分" class="form-control chosen-select" id="baseId" tabindex="2"-->
                    <!--onchange="reLoad()">-->
                    <!--<option selected value="">全部商品</option>-->
                    <!--<option value="0">平台商品</option>-->
                    <!--<option value="1">商户商品</option>-->
                    <!--</select>-->
                    <!--</div>-->
                    <!--<div class="columns pull-left col-md-1 nopadding">-->
                    <!--<select data-placeholder="类型区分" class="form-control chosen-select" id="isKuaidi" tabindex="2"-->
                    <!--onchange="reLoad()">-->
                    <!--<option value="" selected>全部</option>-->
                    <!--<option value="1">快递直发</option>-->
                    <!--<option value="0">团购</option>-->
                    <!--</select>-->
                    <!--</div>-->
                    <input type="hidden" id="flag" th:value="${flag}">
                    <input type="hidden" id="teamId" th:value="${teamId}">
                    <input type="hidden" name="centreId" id="centreId" th:value="${centreId}" th:if="${flag} == '1'">
                    <div class="columns pull-left col-md-2 nopadding" th:if="${flag} == '0'">
                        <select data-placeholder="商户" class="form-control chosen-select"
                                name="centreId" id="centreId" tabindex="2"
                                onchange="renderCategoryThird(this)">
                            <option value="">选择商户</option>
                            <option th:each="item: ${centreList}" th:text="${item.name}"
                                    th:value="${item.centreId}"></option>
                        </select>
                    </div>

                    <div class="columns pull-left col-md-1 nopadding">
                        <input type="text" class=" form-control"
                               id="upStartTime" name="upStartTime" placeholder="上架开始时间"
                               onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
                               style="background-color: #fff;" readonly="readonly"/>
                    </div>
                    <div class="columns pull-left">
                        <label style="font-weight: 700;float: left;padding: 3px 10px;line-height: 2;font-size: 15px">
                            <i class="fa fa-exchange"></i>
                        </label>
                    </div>
                    <div class="columns pull-left col-md-1 nopadding">
                        <input type="text" class=" form-control"
                               id="upEndTime" name="upEndTime" placeholder="上架结束时间"
                               onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
                               style="background-color: #fff;" readonly="readonly"/>
                    </div>

                    <div class="columns pull-left col-md-2 nopadding">
                        <input id="excelFile" name="excelFile" type="file"
                               class="form-control"/>
                    </div>
                    <div class="columns pull-left col-md-1 nopadding">
                        <button class="btn btn-success" onclick="inport()">导入</button>
                    </div>
                    <div class="columns pull-right col-md-1" style="padding-left: 0px;">
                        <a href="/files/外卖商户商品导入模板.xlsx"><u>导入模板</u></a>
                    </div>
                    <div class="pull-left search nopadding">
                        <input id="productName" name="productName" type="text"
                               class="form-control" placeholder="输入需查询的关键字">
                    </div>


                    <div class="columns pull-right" role="group">
                        <button class="btn btn-danger" shiro:hasPermission="product:centre:exportProductCentre"
                                onclick="exportProductCentre()">
                            <i class="fa fa-mail-reply-all" aria-hidden="true"></i>导出
                        </button>
                        <button type="button" class="btn  btn-error" shiro:haspermission="product:centre:remove"
                                onclick="batchRemove()">
                            <i class="fa fa-check" aria-hidden="true"></i>批量删除
                        </button>
                        <button type="button" class="btn  btn-danger " shiro:haspermission="product:centre:remove"
                                onclick="showProductCopy('',1)"><i class="fa fa-check" aria-hidden="true"></i>批量复制
                        </button>
                        <button class="btn btn-success" onclick="reLoad()">
                            <i class="fa fa-search" aria-hidden="true"></i>查询
                        </button>
                    </div>
                </div>
                <table id="productTable" data-mobile-responsive="true"></table>
                <div class="columns pull-left" shiro:hasPermission="product:centre:edit">
                    <button type="button" class="btn  btn-danger"
                            onclick="sortRefund()"><i class="fa fa-check" aria-hidden="true"></i>更新排序
                    </button>
                </div>
            </div>
        </div>
    </div>

    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"
                            aria-hidden="true">×
                    </button>
                    <h4 class="modal-title">选择商品</h4>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="form-horizontal form-search">
                            <div class="col-xs-12">
                                <div class="form-group">
                                    <label class="col-sm-3 control-label no-padding-right"
                                           style="padding-top:2px;">商品搜索：
                                    </label>
                                    <div class="col-sm-9">
                                        <input type="text" name="mgkey" id="mgkey"
                                               placeholder="输入商品ID以及名称搜索"
                                               class="col-xs-10 col-sm-7 form-control">
                                        <span class="input-group-btn">
											<button onclick="get_goods()" type="button"
                                                    class="btn btn-sm btn-primary">搜索
											</button>
											<button onclick="save()" type="button"
                                                    class="btn btn-sm btn-primary">确定
											</button>
										</span>
                                    </div>
                                </div>
                                <div class="space-4"></div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-xs-12">
                            <div>
                                <input name="p" id="p" value="1" type="hidden">
                                <div class="table-responsive">
                                    <table class="table table-striped table-bordered table-hover"
                                           id="dynamic-table">
                                        <thead>
                                        <tr>
                                            <th class="hidden-xs" style="text-align: center">ID</th>
                                            <th>商品图片</th>
                                            <th>商品名称</th>
                                            <th style="border-right: #CCC solid 1px;">操作</th>
                                        </tr>
                                        </thead>
                                        <tbody id="ajax-data">

                                        </tbody>

                                    </table>
                                    <ul class="pagination">
                                        <li><a href="#">&laquo;</a></li>
                                        <li><a href="#">1</a></li>
                                        <li><a href="#">2</a></li>
                                        <li><a href="#">3</a></li>
                                        <li><a href="#">4</a></li>
                                        <li><a href="#">5</a></li>
                                        <li><a href="#">&raquo;</a></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div>
    <!-- 选择商品html部分 end -->

    <!-- 修改库存dialog start -->
    <div class="modal fade" id="modal-teams" tabindex="-1">
        <div class="modal-dialog">
            <div class="modal-content col-xs-7">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"
                            aria-hidden="true">×
                    </button>
                    <h4 class="modal-title">修改库存</h4>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-xs-7">
                            <p id="productTitle"></p>
                            <p><input type="hidden" id="productId" value=""/></p>
                            <input id="total" name="total" placeholder="输入商品库存数量"
                                   class="form-control" type="text" value="">
                            <p></p>
                        </div>
                    </div>
                    <div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix">
                        <div class="ui-dialog-buttonset">
                            <button type="button" class="btn btn-primary" onclick="updateTotal()">
                                确定
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 修改排序dialog start -->
    <div class="modal fade" id="modal-displayorder-teams" tabindex="-1">
        <div class="modal-dialog">
            <div class="modal-content col-xs-7">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"
                            aria-hidden="true">×
                    </button>
                    <h4 class="modal-title">修改排序</h4>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-xs-7">
                            <p id="productTitle"></p>
                            <p><input type="hidden" id="productId" value=""/></p>
                            <input id="displayorder" name="displayorder" placeholder="输入商品排序"
                                   class="form-control" type="text" value="">
                            <p></p>
                        </div>
                    </div>
                    <div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix">
                        <div class="ui-dialog-buttonset">
                            <button type="button" class="btn btn-primary" onclick="updateDisplayorder()">
                                确定
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 复制产品dialog start -->
    <div class="modal fade" id="modal-copy-product" tabindex="-1">
        <div class="modal-dialog">
            <div class="modal-content col-xs-7">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h4 class="modal-title">复制商品</h4>
                </div>
                <p id="copyTitle"></p>
                <input type="hidden" id="copyProductId" value=""/>
                <input type="hidden" id="isBatch" value="0"/>
                <div class="modal-body">
                    <!--                    <div class="row">-->
                    <!--                        <div class="columns pull-left col-md-2 nopadding" th:if="${flag} == '0'">-->
                    <!--                            <select data-placeholder="商户" class="form-control chosen-select"-->
                    <!--                                    name="centreId" id="selectedCentre" tabindex="2"-->
                    <!--                                    onchange="renderTeamList(this)">-->
                    <!--                                <option value="">选择商户</option>-->
                    <!--                                <option th:each="item: ${centreList}" th:text="${item.name}"-->
                    <!--                                        th:value="${item.centreId}"></option>-->
                    <!--                            </select>-->
                    <!--                        </div>-->
                    <!--                    </div>-->
                    <!--                    &lt;!&ndash;商户，并且门店不存在才需要选择门店&ndash;&gt;-->
                    <!--                    <div class="row" th:if="${flag} == '1' and (${teamId} == '' or ${teamId} == null)">-->
                    <!--                        <div>-->
                    <!--                            <p style="text-align:center;">请选择门店<p>-->
                    <!--                            <select id="selectedTeam" class="form-control chosen-select" tabindex="2">-->
                    <!--                                <option value="0" selected>选择门店</option>-->
                    <!--                                <option th:each="item: ${teams}" th:text="${item.tXiaoqu+ +item.id}" th:value="${item.id}"></option>-->
                    <!--                            </select>-->
                    <!--                        </div>-->
                    <!--                    </div>-->
                    <div class="row">
                        <div class="columns pull-left col-md-2 nopadding" th:if="${flag} == '0'" style="width: 100%">
                            <textarea id="centre" rows="3" cols="30" placeholder="请点击选择商户" readonly onclick="toCentre()"
                                      style="width: 100%"></textarea>
                            <input type="hidden" id="centreIds"/>
                        </div>
                    </div>

                    <input type="hidden" id="productType" value="6"/>
                    <div class="row" th:if="${flag} == '1' and (${teamId} == '' or ${teamId} == null)">
                        <div style="width: 100%">
                            <textarea id="store" rows="3" cols="30" placeholder="请点击选择门店" readonly onclick="toStore()"
                                      style="width: 100%"></textarea>
                            <input type="hidden" id="storeIds"/>
                        </div>
                    </div>
<!--                    <div class="row">-->
<!--                        <select id="productType" data-placeholder="商品类型" class="form-control chosen-select"-->
<!--                                tabindex="2">-->
<!--                            <option value="" selected="selected">请选择商品</option>-->
<!--                            <option value="0">普通商品</option>-->
<!--                            <option value="1">预售商品</option>-->
<!--                            <option value="4">预约商品</option>-->
<!--                            <option value="5">积分兑换商品</option>-->
<!--                            <option value="6">外卖商品</option>-->
<!--                            &lt;!&ndash;                            <option value="7">堂食商品</option>&ndash;&gt;-->
<!--                            &lt;!&ndash;                            <option value="8">自提商品</option>&ndash;&gt;-->
<!--                        </select>-->
<!--                    </div>-->
                    <div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix">
                        <div class="ui-dialog-buttonset">
                            <button id="copyButton" type="button" class="btn btn-primary" onclick="copy()">
                                复制
                            </button>
                            <button id="batchCopyButton" type="button" class="btn btn-primary" onclick="batchCopy()">
                                批量复制
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!--shiro控制bootstraptable行内按钮看见性 来自bootdo的创新方案 -->
    <div>
        <script type="text/javascript">
            var s_add_h = 'hidden';
            var s_edit_h = 'hidden';
            var s_remove_h = 'hidden';
            var s_copy_h = 'hidden';
        </script>
    </div>
    <div shiro:hasPermission="product:centre:add">
        <script type="text/javascript">
            s_add_h = '';
        </script>
    </div>
    <div shiro:hasPermission="product:centre:edit">
        <script type="text/javascript">
            s_edit_h = '';
        </script>
    </div>
    <div shiro:hasPermission="product:centre:remove">
        <script type="text/javascript">
            var s_remove_h = '';
        </script>
    </div>
    <div shiro:hasPermission="product:centre:remove">
        <script type="text/javascript">
            var s_copy_h = '';
        </script>
    </div>
</div>
<div th:include="include::footer"></div>
<script src="/js/appjs/product/restaurant/restaurant.js?v=2"></script>
<script src="/js/jquery-select/jquery.searchableSelect.js"></script>
<script type="text/javascript">
    $(function () {
        $('#supply').searchableSelect();
        /* $('#liansuoid').searchableSelect(); */
        /* $('#centreId').searchableSelect(); */
    });
</script>
</body>

</html>